<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html; UTF-8" pageEncoding="UTF-8" isELIgnored="false" %><!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>班委管理</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/back/statics/css/bootstrap3.min.css">
    <script src="${pageContext.request.contextPath}/back/statics/js/jquery-1.8.3.min.js"></script>
</head>
<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-sm-4  col-sm-offset-4">
            <h1 class="text-center">班委管理</h1>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <table class="table table-striped table-bordered table-hover">
                <tr>
                    <th>编号</th>
                    <th>姓名</th>
                    <th>学号</th>
                    <th>职位</th>
                    <th>所属班级</th>
                    <th>电话</th>
                    <th>操作</th>
                </tr>
                <c:forEach items="${requestScope.class_coms}" var="class_coms">
                    <tr>
                        <td>${class_coms.id}</td>
                        <td>${class_coms.name}</td>
                        <td>${class_coms.s_number}</td>
                        <td>${class_coms.post}</td>
                        <td>
                                ${class_coms.classid}
                                <c:if test="${class_coms.classid==NULL}">
                                    ${class_coms.class_z.in_class}
                                </c:if>
                        </td>
                        <td>${class_coms.phone}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/committee/delete/${class_coms.id}" class="btn btn-danger btn-sm">删除</a>
                            <a href="${pageContext.request.contextPath}/committee/change/${class_coms.id}" class="btn btn-primary btn-sm" >修改</a>
                        </td>
                    </tr>
                </c:forEach>
            </table>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <form action="${pageContext.request.contextPath}/committee/save" method="post" id="input" class="form-inline">
                <div class="form-group">
                    <label for="name">学生姓名：</label>
                    <input type="text" class="form-control" id="name" name="name" placeholder="请输入学生姓名">
                </div>
                <div class="form-group">
                    <label for="s_number">学生学号：</label>
                    <input type="text" class="form-control" id="s_number" name="s_number" placeholder="请输入学生学号">
                </div>
                <div class="form-group">
                    <label for="post">学生职位：</label>
                    <input type="text" class="form-control" id="post" name="post" placeholder="请输入学生职位">
                </div>
                <div style="margin-top: 3px;">
                    <div class="form-group">
                        <label for="phone">联系方式：</label>
                        <input type="text" class="form-control" id="phone" name="phone" placeholder="请输入联系方式">
                    </div>


                    <div class="form-group">
                        <label for="classid">所属班级:</label>
                        <select name="classid" id="classid" class="form-control">
                            <option value="计算数据1871">计算数据1871</option>
                            <option value="计算数据1872">计算数据1872</option>
                        </select>
                    </div>
                    <button type="submit" class="btn btn-success">添加标签</button>
                </div>



            </form>
        </div>
    </div>
</div>
</body>
</html>
<script>
    $(function (){
        $("#input").submit(function (){
            if (!$("#name").val()){
                alert("学生姓名不能为空");
                return false;
            }
            if (!$("#s_number").val()){
                alert("学生学号不能为空");
                return false;
            }
            if (!$("#post").val()){
                alert("学生职位不能为空");
                return false;
            }
            if (!$("#phone").val()){
                alert("联系方式为空");
                return false;
            }
        });
    })
</script>